ZONE2021 D
種別: 記事
カテゴリ: 競技プログラミング
サブカテゴリ: AtCoder > ZONeエナジー プログラミングコンテスト “HELLO SPACE”
タグ: #解いた問題
(工事中)
2021年5月1日にAtCoder で開催されたコンテストであるZONeエナジー プログラミングコンテスト “HELLO SPACE” のD問題に関するメモ
解き方
解答例
下は上記の方法で解いたときの提出結果である。また、その提出の際に提出したソースコードをその下に転記する。
code: C
#include <stdio.h>
#include <stdlib.h>
typedef struct list {
char c;
struct list *next2;
} list;
int main () {
char s500001 = "";
int res = 0;
int direct = 0;
list *hdtl2 = {};
int i = 0;
list pool500000 = {};
int used = 0;
char prev = 0;
int isFinished = 0;
res = scanf("%s", s);
while(si != '\0') {
if (si == 'R') {
direct = (direct + 1) % 2;
} else {
if (hdtldirect == NULL || hdtldirect->c != si) {
list *l = pool + used;
used++;
l->c = si;
l->nextdirect = hdtldirect;
if (hdtldirect != NULL) {
hdtldirect->next(direct + 1) % 2 = l;
}
hdtldirect = l;
if (hdtl(direct + 1) % 2 == NULL) {
hdtl(direct + 1) % 2 = l;
}
} else {
if(hdtldirect->nextdirect == NULL) {
hdtldirect = NULL;
hdtl(direct + 1) % 2 = NULL;
} else {
hdtldirect = hdtldirect->nextdirect;
hdtldirect->next(direct + 1) % 2 = NULL;
}
}
}
i++;
}
direct = (direct + 1) % 2;
while(isFinished == 0) {
list *l = hdtldirect;
list *prev = NULL;
isFinished = 1;
while (l != NULL && l->nextdirect != NULL) {
if(l->c == l->nextdirect->c) {
list *tmp = NULL;
if (prev == NULL) {
hdtldirect = l->nextdirect->nextdirect;
} else {
prev->nextdirect = l->nextdirect->nextdirect;
}
tmp = l->nextdirect->nextdirect;
l = l->nextdirect->nextdirect;
if (l != NULL) {
l->next(direct + 1) % 2 = prev;
}
isFinished = 0;
} else {
prev = l;
l = l->nextdirect;
}
}
if(isFinished != 0) {
list *l = hdtldirect;
while (l != NULL) {
printf("%c", l->c);
l = l->nextdirect;
}
}
}
printf("\n");
return 0;
}
私の提出一覧
table: submissions_abc-like_contest_zone2021_D
提出のURL 提出時刻 結果 備考
1回目 https://atcoder.jp/contests/zone2021/submissions/22229708 2021-05-01T22:29:00+0900 TLE コンテスト中の提出
2回目 https://atcoder.jp/contests/zone2021/submissions/22230555 2021-05-01T22:31:27+0900 TLE コンテスト中の提出
3回目 https://atcoder.jp/contests/zone2021/submissions/22231729 2021-05-01T22:34:46+0900 WA コンテスト中の提出
4回目 https://atcoder.jp/contests/zone2021/submissions/22234239 2021-05-01T22:39:54+0900 RE コンテスト中の提出
5回目 https://atcoder.jp/contests/zone2021/submissions/22236368 2021-05-01T22:54:41+0900 AC コンテスト終了後
感想
(工事中)
コンテスト中に解けなかったが、コンテスト終了してから15分後に解いた
(B問題を解いた後、何をしていたんだろう…)当時のことははっきり思い出せないかな